<template>
	<view class="container">
		<view class="content" v-if="data.list&&data.list.length>0">
			<view class="list_box" @click="goDetails(item.id)" v-for="item in data.list">
				<view class="lf list_text">
					<image class="bank_img" :src="item.receiverBankLogo"></image>
					<view class="bank_width">
						<view class="xjs-size-32 linehei1">提现到{{item.receiverBankName.split(',')[0]}}(*****{{item.receiverBankAccount.substring(item.receiverBankAccount.length-4)}})</view>
						<view class="time_text linehei1">{{item.createTime}}</view>
					</view>
				</view>
				
				<view class="xjs-weight-bold active_box">
					<view class="xjs-size-32 ">¥{{item.amount}} </view>
					<view class="xjs-mt-16 xjs-size-28 btn-color" v-if="item.tradeStatus===0||item.tradeStatus===1">待审核</view>
					<view class="xjs-mt-16 xjs-size-28" v-if="item.tradeStatus==2">提现成功</view>
					<view class="xjs-mt-16 xjs-size-28 btn-color1" v-if="item.tradeStatus==3">提现失败</view>
				</view>
			</view>
		</view>
		<view class="noRecord" v-if="data.loading">
			暂无提现记录～
		</view>
	</view>
</template>

<script setup lang="ts">
	import { reactive } from 'vue';
	import { onLoad ,onReachBottom} from '@dcloudio/uni-app'
	import api from '@/api'
	let data = reactive<any>({
		list:[],
		page:1,
		limit:10,
		loading: false,
		finished: false,
	})	
	const getList =async()=>{
		uni.showLoading({
		  title: '加载中',
		  mask: true
		}) 
		const res : any = await api({
			method: 'get',
			url: `/mall/studio/studio-balance-withdraw-record/page`,
			data:{
				page:data.page,
				limit:data.limit
			}
		})
		if (res.data.records.length != 0) {
			data.list = data.list.concat(res.data.records);
			data.finished = true
		}else{
			data.finished = false
		}
		if (data.list.length <= 0) {
			data.loading = true
		}
		uni.hideLoading()
	}
	const goDetails = (id: any)=>{
		uni.navigateTo({
			url:'/pages/myStudio/studio/recordDateils/index?id='+id
		})
	}
	// 触底
	onReachBottom(() => {
	  if (data.finished && !data.loading) {
	  	data.page++
	  	getList()
	  }
	})
	onLoad(() => {
		getList()
	})
</script>

<style lang="scss" scoped>
	.container{
		padding-bottom: var(--safe-area-bottom);
		// #ifdef APP
		padding-bottom: calc(24rpx + var(--safe-area-bottom));
		// #endif
	}
	.lf {
		display: flex;
	}
	.linehei1{
		line-height: 1;
	}
	.lf-between {
		justify-content: space-between;
	}
	.lf-center{
		align-items: center;
	}
	.noRecord{
		margin-top: 48%;
		text-align: center;
		font-size: 32rpx;
	}
	.btn-color{
		color: #FF6084;
	}
	.btn-color1{
		color: #6363FF;
	}
	.bank_width{
		width: 85%;
	}
	.content{
		background-color: #fff;
		margin: 32rpx;
		border-radius: 24rpx;
		.list_box{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin:0 32rpx;
			padding: 48rpx 0;
			border-bottom: 1rpx solid #E4E6E6;
		}
		.list_text{
			width: 75%;
		}
		.list_box:last-child{
			border-bottom: 0rpx solid;
		}
		.bank_img{
			width: 48rpx;
			height: 48rpx;
			border-radius: 50%;
			margin-right: 18rpx;
		}
		.time_text{
			color: #7C807F;
			font-size: 26rpx;
			margin-top: 16rpx;
		}
		.active_box{
			text-align: right;
		}
	}
</style>